<template>
	<view class="">
		<view class="group-info" v-for="(item, i) in list" :key="i" @click="groupDetail()">
			<view class="txl-org-item" v-show="deleteIds.indexOf(item.accountId)==-1">
				<view class="logo-name">
					<image class="logo" :src="handleHead(item)" mode="aspectFill"></image>
					<text class="name">{{item.name}}</text>
					
				</view>
				<uni-icons customPrefix="iconfont" type="icon-icon--" size="40rpx"></uni-icons>
				<uni-icons @click="deleteUser(item, i)" type="closeempty" color="#aaa"></uni-icons>
			</view>
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			list: [],
			deleteIds: []
		}   
	},
	onLoad() {
		this.list = uni.getStorageSync('xdSelectAllInfo')
	},
	onNavigationBarButtonTap(e){
		this.keep()
	},
	methods: {
		handleHead(item){
			return item.qun?`/static/txl/qlx${item.type>3?'3':item.type}.png`:item.userType?this.utils.headImage(item):'/static/txl/zzjg-icon.png'
		},
		keep(){
			for(let i=0; i<this.deleteIds.length; i++){
				let id = this.deleteIds[i]
				let delI = this.list.findIndex(item=>(item.accountId&&item.accountId==id) || (item.orgType&&item.id==id))
				if(delI!=-1){
					this.list.splice(delI, 1)
				}
				
			}
			uni.setStorageSync('xdSelectAllInfo', this.list)
			this.utils.goBack()
		},
		groupDetail(){
			
		},
		deleteUser(item, i){
			let id = item.accountId || item.id
			this.deleteIds.push(id)
			this.list.splice(i, 1)
			// uni.setStorageSync('xdSelectAllInfo', this.list)
		}
	}
}
</script>
<style lang="less" scoped>

</style>